<?php 
namespace Member\Controller;
use \Common\Controller\BaseController;
class InitController extends BaseController {
	public function _initialize() {
		parent::_initialize();
		$this->db = D('Member');
		$this->group_db = D('MemberGroup');
		$this->space_db = D('MemberSpace');
		$this->userid = (int) cookie('_userid');
		if ($this->userid < 1) {
			$this->error('您尚未登录', U('Index/login'));
		}
		$userinfo = $this->db->getByUserid($this->userid);
		if (empty($userinfo['nickname'])) {
			$userinfo['nickname'] = '匿名用户_'.$userinfo['userid'];
		}
		$groupid = $userinfo['groupid'];
 		$userinfo['groupname'] = $this->group_db->getFieldByGroupid($groupid,'name');
 		
 		$userinfo['discription'] = $this->space_db->where(array('userid'=>$this->userid ))->getField('discription');
		$userinfo['avatar'] = getavatar($this->userid);
		$this->userinfo = $userinfo;
		helpers('time');
	}
}
?>